import * as http from '@api/http'

/**
 * @purpose 获取用户登录凭证
 * @param code
 * @param token
 * @returns {PromiseLike<T> | Promise<T> | *}
 */
export function token (code, token) {
  return http
    .get('sign.token', {
      code: code,
      token: token
    })
    .then(r => r)
}

/**
 * @purpose 通过用户名密码登录
 * @param username
 * @param password
 * @returns {Promise<T>}
 */
export function signInByPassword (username = '', password = '') {
  return http
    .post('sign.signInByPassword', {
      username: username,
      password: password
    })
    .then(r => r.data)
}
